package com.imu.upload.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@RestController
@RequestMapping("/login")
public class LoginController {
    @GetMapping
    public void login(HttpServletRequest request, HttpServletResponse response,String username, String password) throws IOException {
        if (username.equals("zhangjia")&&password.equals("123456")){
            HttpSession session = request.getSession();
            session.setAttribute("user",password);
            response.sendRedirect("/static/upload.html");
        }

    }
}
